/*
 * Copyright (c) 2009 the original author or authors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package com.as3undohistory.manage
{
	import com.as3undohistory.register.IObjectRegistration;
	
	import flash.events.IEventDispatcher;

	/**
	 * Describes an object that allows objects to be registered for property change recording. The recording
	 * of property changes is done chronologically and calling undo will execute this operation on a last-in/first-out basis.
	 * @author Roland Zwaga
	 * 
	 */
	public interface IUndoHistoryManager extends IEventDispatcher
	{
		/**
		 * An implementation of IObjectRegistration which takes care of analyzing the metadata of the objects being registered
		 * @return 
		 * @see com.as3undohistory.register.IObjectRegistration IObjectRegistration
		 * 
		 */
		function get objectRegistration():IObjectRegistration;
		
		/**
		 * Starts the process of recording property changes on the specified instance 
		 * @param instance
		 * 
		 */
		function addObject(instance:Object):void;
		/**
		 * Ends the process of recording property changes on the specified instance by removing the object
		 * registration objects
		 * @param instance
		 * 
		 */
		function removeObject(instance:Object):void;
		
		/**
		 * Retrieves the last property change and sets it back to the previous value. 
		 * 
		 */
		function undo():void;
		
		/**
		 * Clears the undohistory for all registred objects. 
		 * @param clearRegistration if true than all object registration information will be deleted as well.
		 * 
		 */		
		function clear(clearRegistration:Boolean = false):void;
		
		/**
		 * Starts a transaction. All property changes that happen within one transaction will be undone when
		 * the undo method is called. 
		 * 
		 */
		function startTransaction():void;
		/**
		 * Ends the current transaction. 
		 * 
		 */		
		function endTransaction():void;
	}
}